package com.briup.ch07.object;

import java.util.Objects;

public class Student {
    //属性私有
    private String name;
    private Integer age;
    private Double price;
    private Boolean isWeek;
    //公开的get/set

    public Student(String name) {
        this.name = name;
    }

    public Student() {
    }

    public Student(String name, Integer age, Double price, Boolean isWeek) {
        this.name = name;
        this.age = age;
        this.price = price;
        this.isWeek = isWeek;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", price=" + price +
                ", isWeek=" + isWeek +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(name, student.name) && Objects.equals(age, student.age) && Objects.equals(price, student.price);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Boolean getWeek() {
        return isWeek;
    }

    public void setWeek(Boolean week) {
        isWeek = week;
    }
}
